# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-bitstruct
pkgver=8.19.0
pkgrel=1
pkgdesc="Python bit pack/unpack package"
url="https://github.com/eerimoq/bitstruct"
arch="all"
license="MIT"
depends="py3-codespell"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/eerimoq/bitstruct/archive/refs/tags/$pkgver.tar.gz"
options="!check" # Fails to import bitstruct.c
builddir="$srcdir/bitstruct-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
9a3f7068664d70b86db1da4df4d3e650b774e89d69d71d9e6d73cc26ff98d5e606618301fa817ca5021d77a16b75c7b4c4f5d386a6b346104786de50ce9b02aa  py3-bitstruct-8.19.0.tar.gz
"
